package com.kkb.mybatis;

import com.kkb.mybatis.config.Configuration;
import com.kkb.mybatis.config.Resources;
import com.kkb.mybatis.config.XMLConfigParser;
import com.kkb.mybatis.utils.DocumentUtils;
import org.dom4j.Document;
import org.junit.Before;
import org.junit.Test;

import java.io.InputStream;

/**
 * User: zsl
 * Date: 2019/10/1011:19
 * Description:
 */
public class UserDaoTest {

    @Before
    public void init(){
        //配置文件地址
        String resources = "SqlMapConfig.xml";
        //获取配置文件的流
        InputStream resourceAsStream = Resources.getResourceAsStream(resources);
        //获取xml的document树
        Document document = DocumentUtils.readDocument(resourceAsStream);
        //解析 xml 的 document
        XMLConfigParser xmlConfigParser = new XMLConfigParser();

        //获取 configuration 对象
        Configuration configuration = xmlConfigParser.parse(document.getRootElement());
        System.out.println(configuration);
    }


    @Test
    public void testQueryUserById(){
        System.out.println("没啥");
    }
}
